<?php
class GradesController extends AppController {
    var $name = 'Grades';
    
    function choose_for_performance_add() {
        $this->pageTitle = "选择班级";
        $grades = $this->Grade->find('all');
        $arr_for_options = array();
        foreach ($grades as $grade):
            $arr_for_options[$grade['Grade']['id']] = $grade['Grade']['enroll_year']."届".$grade['Grade']['class_number']."班";
        endforeach;
        $this->set('ops', $arr_for_options);
        if ($this->Auth->user('role') == 'teacher') {
            if ($this->data) {
                $this->redirect(array('controller' => 'student_profiles', 'action' => 'list_for_performance_add', $this->data['Grade']['grade_id']));
            }
        }
        else {
            $this->Session->setFlash("您没有相应的权限");
            $this->redirect(array('controller' => 'users', 'action' => 'login'));
        }
    }
}
?>